package com.xjm.i1.core.struct.node.load;

import com.xjm.i1.entity.ColorContrastArea;
import com.xjm.i1.entity.ColorDiffDensityArea;
import com.xjm.i1.entity.ColorGrayArea;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * 加载数据的区域节点数据集合
 **/
@Data
public class I1AreaCollections {

    // 灰度偏差数据集合
    private List<ColorGrayArea> colorGrayAreas;

    // 阶调数据集合
    private List<ColorContrastArea> colorContrastAreas;

    // 色差与密度集合
    private List<ColorDiffDensityArea> colorDiffDensityArea;

    // 打印页区域 COLOR_CONTRAS_GRAY 或 COLOR_DIFF_DENSITY
    private AreaType areaType;

    /*public I1AreaCollections(int initGrayArea, int initContrastArea, int initDiffDensityArea) {
        colorGrayAreas = new ArrayList<>(initGrayArea);
        colorContrastAreas = new ArrayList<>(initContrastArea);
        colorDiffDensityArea = new ArrayList<>(initDiffDensityArea);
    }*/

    public I1AreaCollections(int initGrayArea, int initContrastArea) {
        if (initContrastArea < 1 || initGrayArea < 1) {
            initGrayArea=8;
            initContrastArea=8;
        }
        colorDiffDensityArea = null;
        colorGrayAreas = new ArrayList<>(initGrayArea);
        colorContrastAreas = new ArrayList<>(initContrastArea);
        areaType = AreaType.COLOR_CONTRAS_GRAY;
    }

    public I1AreaCollections(int initDiffDensityArea) {
        if (initDiffDensityArea < 1) {
            initDiffDensityArea=8;
        }
        colorGrayAreas = null;
        colorContrastAreas = null;
        colorDiffDensityArea = new ArrayList<>(initDiffDensityArea);
        areaType = AreaType.COLOR_DIFF_DENSITY;
    }

    public enum AreaType{
        COLOR_CONTRAS_GRAY, COLOR_DIFF_DENSITY
    }

    @Override
    public String toString() {
        return "I1AreaCollections{\n" +
                "colorGrayAreas=" + colorGrayAreas +
                ",\n colorContrastAreas=" + colorContrastAreas +
                ",\n colorDiffDensityArea=" + colorDiffDensityArea +
                "\n}";
    }
}
